<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>03 date的操作</title>
</head>

<body>


    <script>
        var date = new Date();
        console.log('date:', date);

        //当前日期的时间戳
        var b = +new Date();
        var c = new Date().getTime();
        console.log(b, c);

        // 2. new Date(milliseconds);

        var a = new Date(1602661963633);
        console.log('a:', a);

        // 3. new Date('2020-03-16');
        var a = new Date('2020-03-14');
        console.log('A:', a); //Mon Mar 16 2020 08:00:00 GMT+0800 (中国标准时间)

        // 4.
    </script>
</body>

</html>